home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15340 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news.chevron.com!news
  2. From: gacwra@hsun13.hou281.chevron.com (C.W.Racer)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: big endian, little endian
  5. Date: 18 Apr 1996 15:28:38 GMT
  6. Organization: Chevron
  7. Sender: gacwra@hsun13 (C.W.Racer)
  8. Message-ID: <4l5n36$qk8@hsun27.chevron.com>
  9. References: <4ku9dm$t1t@news.ycc.yale.edu> <3172C1E9.3E95@willows.com>
  10. NNTP-Posting-Host: hsun13.hou281.chevron.com
  11.  
  12. In article <3172C1E9.3E95@willows.com>, Tarang Deshpande <tarang@willows.com> writes:
  13. |> rmurphy wrote:
  14. |> > 
  15. |> > Hi.  I'm a graduate student doing research in computer music, and i
  16. |> > have a small tech question I can't seem to get answered in the c
  17. |> > reference books.  What is the difference between big-endian and
  18. |> > little-endian?  I know it relates somehow to signed/unsigned integers,
  19. |> > and the division between ibm & 68k-based platforms, but have no clue
  20. |> > beyond that.  Thanks.
  21. |> > rmurphy@minerva.cis.yale.edu
  22. |> 
  23. |> 
  24. |> Actually it has nothing to with signed/unsigned integer rather it has to
  25. |> do with how integers are represented in memory on different platforms.
  26. |> In the representation of a two byte integer the question becomes is the
  27. |> high byte or the low byte at the lower or higher address.  If the 
  28. |> low byte is at the lower address then it uses little endian whereas if
  29. |> the high byte is at the lower address then it used big endian.
  30. |> 
  31. |> So the number 256 which is 0000000100000000 in binary can be thought off
  32. |> as 00000001 * 256 + 00000000 where the 00000001 is the high byte and
  33. |> 00000000 is the low byte.  On a little endian platform memory would look
  34. |> like 0000000000000001 whereas on a big endian platform memory would look
  35. |> like 0000000100000000.  
  36. |> 
  37. Actually the representation is the same, only the byte numbering is 
  38. different.
  39.  
  40. -- 
  41. | Chick Racer                     Chevron Petroleum Technology Co. |
  42. | (713) 596-2430                  P.O. Box 42832                   |
  43. | gacwra@chevron.com              Houston, Tx 77242-2832           |
  44. | 4119 Hayes Rd.                                                   |
  45.